<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Pelanggan extends CI_Controller {

    var $title = "Data Pelanggan";

	public function index()
	{
        //load header pelanggan
        $data_header['title'] = $this->title;
        $data_header['js_list'] = array('pelanggan/default');
		$this->load->view('pelanggan/header_view', $data_header);
        
        $this->load_body();
        
        //load footer pelanggan
		$this->load->view('pelanggan/footer_view');
	}
    
    private function load_body()
    {
        //load view pelanggan
        $this->load->model('pelanggan_model');
        $data['pelanggan_array'] = $this->pelanggan_model->get();
        
		$this->load->view('pelanggan/home_view', $data);
    }

    public function save()
    {
        $this->load->model('pelanggan_model');
        $this->pelanggan_model->save();
        
        $this->load_body();
    }
    
    public function delete()
    {
        $this->load->model('pelanggan_model');
        $this->pelanggan_model->delete();
        
        $this->load_body();
    }
    
}